#!/bin/bash

file="$(grep -v "PROMPT: " $1)"
prompt="$(grep "PROMPT: " $1 | sed 's/PROMPT: //g' | shuf -n 1)"
entry="$(echo "$file" | awk '{split($0, a, " CMD: "); print a[1]}' | rofi -dmenu -i -p $prompt)"

if [[ -z "$entry" ]]; then
    exit
fi

eval "$(echo "$file" | grep "$entry CMD: " | awk '{split($0, a, " CMD: "); print a[2]}')"
